﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Method.ascx.cs" Inherits="ERP.Modules.Method" %>

<%-------------------------------%>
<ext:Hidden ID="FormatTypeMethod" runat="server" />
<ext:Panel runat="server" Layout="Fit" Border="False" ID="PanelMethod">
    <Content>
        <%--------------GridMethod-----------------%>
        <ext:GridPanel
            ID="grMethod"
            Cls="grid-double"
            runat="server"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <%-------------StoreMethod-----------------%>
                <ext:Store
                    ID="StoreMethod"
                    runat="server"
                    OnReadData="StoreMethod_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model ID="ModelMethod" runat="server" IDProperty="Method_ID">
                            <Fields>
                                <ext:ModelField Name="Method_Alias" Type="String" />
                                <ext:ModelField Name="Method_Name" Type="String" />
                                <ext:ModelField Name="Method_Note" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="30" Align="Center" />
                    <ext:Column ID="Column2" runat="server" Text="Mã phương thức" Width="150" DataIndex="Method_Alias"></ext:Column>
                    <ext:Column ID="Column3" runat="server" Text="Tên phương thức" Width="200" DataIndex="Method_Name"></ext:Column>
                    <ext:Column ID="Column4" runat="server" Text="Ghi chú" Width="100" DataIndex="Method_Note" Flex="1"></ext:Column>
                </Columns>
            </ColumnModel>
            <DirectEvents>
                <ItemDblClick OnEvent="MethodDblClick">
                    <ExtraParams>
                        <ext:Parameter Name="Method_ID" Value="record.data.Method_ID" Mode="Raw" />
                    </ExtraParams>
                    <EventMask ShowMask="true" Msg="Đang tải..." />
                </ItemDblClick>
            </DirectEvents>
            <SelectionModel>
                <ext:CheckboxSelectionModel ID="CheckboxSelectionModelMethod" runat="server" Mode="Multi">
                    <Listeners>
                       <SelectionChange Handler="
                            if (selected.length == 0) {
                                #{btnEdit}.disable();
                                #{btnDel}.disable();
                                #{btnExport}.disable();
                            } else {
                                #{btnEdit}.enable();
                                #{btnDel}.enable();
                                #{btnExport}.enable();
                            }" />
                   </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <DockedItems>
                <ext:Toolbar ID="ToolbarTopMain" runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnAddNew" runat="server" Text="Thêm mới" Icon="ApplicationAdd">
                            <DirectEvents>
                                <Click OnEvent="btnAddNew_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>

                        <ext:Button ID="btnEdit" runat="server" Text="Sửa" Icon="ApplicationEdit">
                            <DirectEvents>
                                <Click OnEvent="btnEdit_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>

                        <ext:Button ID="btnDel" runat="server" Text="Xoá" Icon="ApplicationDelete">
                            <DirectEvents>
                                <Click OnEvent="btnDel_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá mẫu tin này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>

                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grMethod}, #{FormatTypeMethod}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>

                    </Items>
                </ext:Toolbar>
                <ext:Toolbar ID="ToolbarPagging" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event"></TriggerClick>
                                <KeyPress OnEvent="Search_Event"></KeyPress>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar ID="PagingToolbarMethod" runat="server" StoreID="StoreMethod" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
<ext:Panel runat="server">
    <Content>
        <%-----------WindowsMethod-----------------%>
        <ext:Window ID="WindowsMethod" runat="server"
            Title="Cập nhật phương thức"
            DefaultAnchor="100%"
            Width="379px"
            Height="207px"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="false"
            Modal="true"
            HideMode="Offsets"
            Border="false"
            Padding="5"
            DefaultButton="btnSavePopUp">
            <Items>
                <ext:Toolbar ID="ToolbarMethod" runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Lưu lại" Icon="Disk" ID="btnSavePopUp">
                            <DirectEvents>
                                <Click OnEvent="btnSavePopUp_Click" Before="return #{FormPanelMethod}.isValid();">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:Button runat="server" Text="Huỷ bỏ" Icon="Decline" ID="btnCancelPopUp">
                            <DirectEvents>
                                <Click OnEvent="btnCancelPopUp_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:TextField ID="txtMethod_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                    </Items>
                </ext:Toolbar>
                <ext:FormPanel ID="FormPanelMethod" runat="server"
                    AutoHeight="true"
                    BodyPadding="10"
                    Frame="true"
                    DefaultAnchor="100%">
                    <Items>
                        <ext:TextField ID="txtMethod_Alias" runat="server" FieldLabel="Mã phương thức" AnchorHorizontal="100%" AllowBlank="false" />
                        <ext:TextField ID="txtMethod_Name" runat="server" FieldLabel="Tên phương thức" AnchorHorizontal="100%" AllowBlank="false" />
                        <ext:TextArea ID="txtMethod_Note" runat="server" FieldLabel="Ghi chú" AnchorHorizontal="100%" />
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Window>
    </Content>
</ext:Panel>